/*
 * MainMenu.java
 * 
 * Main interface for Chemical Calculator.
 * 
 * From here you have acess to all the programs capabilities
 * 
 * Author: Andres Ruiz 
 * License: see License.txt
 */
import java.util.*;

public class MainMenu
{
	Scanner c = new Scanner(System.in);
	RunModules run = new RunModules();
	private int menuSel = 0;
	public MainMenu()
	{
		System.out.println("Hello, welcome to the Chemistry Periodic Table of elements suite\n");
		License();
		showMenu();
		//run.periodicDebug();
	}
	public void showMenu()
	{
		System.out.println("Please select one of the avilable options");
		System.out.println("0. Help");
		System.out.println("1. Search of Element Information");
		System.out.println("2. Calculate Moles");
		System.out.println("3. Calculate Empiric Formula");
		System.out.println("4. Find the true molecular formula");
		
		System.out.println("9. Exit");
		menuSel = c.nextInt();

		switch (menuSel)
		{
			case 0:
				Help(); break;
			case 1:
				run.Search(); break;
			case 2:
				run.MoleCalculator(); break;
			case 3:
				run.EmpiricalCalc(); break;
			case 4:
				run.MolecularFormula(); break;
			default:
				Exit(); break;
		}

		System.out.println("Quit?");
		System.out.println("Y/N");
		String Answer = c.next();
		if (!Answer.equalsIgnoreCase("Y"))
			showMenu();
	}
	public void Exit()// terminate prgram
	{
	}
	public void Help()// Help documentation
	{
		System.out.println("           Chemical Calculator Help Info");
		System.out.println("              Created by: Andres Ruiz");
		System.out.println();
		System.out.println("Firstly I would like to thank you for using this software.");
		System.out.println("Alot of time was spent making this great program.");
		System.out.println();
		System.out.println("Menu Options");
		System.out.println();
		System.out.println("1. Search of Element Information - ");
		System.out.println("This option asks you for the name, symbol or atomic number of a element.");
		System.out.println("Then gives you back th information stored for that element.");
		System.out.println();
		System.out.println("2. Calculate Moles - ");
		System.out.println("This option asks you for an element and the amount of that element that you have.");
		System.out.println("Then prints you the amount of moles of that element");
		System.out.println();
		System.out.println("3. Calculate Empiric Formula - ");
		System.out.println("This option asks you for a set of elements found in a % of a compound.");
		System.out.println("Just type the element name or symbol followed by its % without the % symbol");
		System.out.println("It will then print you the aproximate empirical formula of that compound");
		System.out.println();
		System.out.println("4. Find the true molecular formula - ");
		System.out.println("This option ask you for an empirical formula to then give you the actual chemical formula");
		System.out.println("Just type the element name or symbol followed by its subscript");
		System.out.println("Then type the compounds molar mass and the program takes care of the rest.");
		System.out.println("Youll receve the multiplier to get the actual chemical formula.");
		System.out.println("This will be an aproximate number. You must round it acordingly.");
	}
	public void License()
	{
		System.out.println("For more detailed license information please see license.txt\n");
		System.out.println("    Chemical Calculator is free software: you can redistribute it and/or modify");
		System.out.println("it under the terms of the GNU General Public License as published by");
		System.out.println("the Free Software Foundation, either version 3 of the License, or");
		System.out.println("(at your option) any later version.");
		System.out.println();
		System.out.println("This program is distributed in the hope that it will be useful,");
		System.out.println("but WITHOUT ANY WARRANTY; without even the implied warranty of");
		System.out.println("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the");
		System.out.println("GNU General Public License for more details.");
		System.out.println();
		System.out.println("You should have received a copy of the GNU General Public License");
		System.out.println("along with this program.  If not, see <http://www.gnu.org/licenses/>.\n");

	}
}